<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/6/006
 * Time: 9:07
 */

namespace app\api\model;


class ProductAttr extends BaseModel {
    protected $hidden = ['update_time','delete_time', 'create_time'];


    public function getImageAttr($value) {
        return get_img_url($value);
    }

    /**
     * 根据产品ID获取产品属性组
     * @param $id
     * @return array|\PDOStatement|string|\think\Collection
     */
    public static function getProductAttrByProductId($id) {
        $product_attr_group = self::where('product_id', '=', $id)->order('price desc')->select();
        return $product_attr_group;
    }
}